<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4" data-th-fragment="header">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- CSRF -->
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <!-- default header name is X-CSRF-TOKEN -->
    <meta name="_csrf_header" th:content="${_csrf.headerName}"/>

    <link th:href="@{/editormd/editormd.css}" rel="stylesheet"/>

    <!-- Tether core CSS -->
    <link th:href="@{/css/tether.min.css}" rel="stylesheet">

    <!-- Bootstrap CSS -->
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">

    <!-- Font-Awesome CSS -->
    <link th:href="@{/css/font-awesome.min.css}" rel="stylesheet">

    <!-- NProgress CSS -->
    <link th:href="@{/css/nprogress.css}" rel="stylesheet">

    <!-- bootstrap tags CSS -->
    <link th:href="@{/css/jquery.tagsinput.min.css}" rel="stylesheet">

    <!-- bootstrap chosen CSS -->
    <link th:href="@{/css/component-chosen.min.css}" rel="stylesheet">

    <!-- toastr CSS -->
    <link th:href="@{/css/toastr.min.css}" rel="stylesheet">

    <!-- jQuery image cropping plugin CSS -->
    <link th:href="@{/css/cropbox.css}" rel="stylesheet">

    <!-- Custom styles -->
    <link th:href="@{/css/style.css}" rel="stylesheet">
    <link th:href="@{/css/thymeleaf-bootstrap-paginator.css}"
          rel="stylesheet">
    <link th:href="@{/css/blog.css}" rel="stylesheet">

    <title>我的博客</title>
</head>
<body>
<nav class="navbar navbar-inverse bg-inverse navbar-toggleable-md">
    <div class="container" id="navContainer">
        <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
                data-target="#navbarsContainer">
            <span class="navbar-toggler-icon"></span>
        </button>
        <a class="navbar-brand" href="/" th:href="@{/}">NewStarBlog</a>

        <div class="collapse navbar-collapse" id="navbarsContainer">

            <ul class="navbar-nav mr-auto">
                <li class="nav-item">
                    <a class="nav-link" href="javascript:void(0)" th:attr="url='/blogs?order=new'">最新<span
                            class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="javascript:void(0)" th:attr="url='/blogs?order=hot'">最热</a>
                </li>
                <form class="form-inline mt-2 mt-md-0">
                    <input class="form-control mr-sm-2" type="text" placeholder="搜索" id="indexkeyword"
                           th:value="${keyword}">
                    <a href="javascript:void(0)" class="btn btn-outline-secondary my-2 my-sm-0" id="indexsearch"><i
                            class="fa fa-search" aria-hidden="true"></i></a>
                </form>

            </ul>
            <div sec:authorize="isAuthenticated()" class="row">
                <div class="dropdown">
                    <a class=" dropdown-toggle" href="/u/minato" th:href="@{'/u/' + ${#authentication.name}}"
                       data-toggle="dropdown"><span sec:authentication="name"></span></a>
                    <div class="dropdown-menu">
                        <a class=" dropdown-item" href="/u/minato" th:href="@{'/u/' + ${#authentication.name}}">个人主页</a>
                        <a class="dropdown-item" href="/u/minato/profile"
                           th:href="@{'/u/' + ${#authentication.name}} + '/profile'">个人设置</a>
                    </div>
                </div>
                <div>
                    <a href="/u/minato/blogs/edit" th:href="'/u/' + ${#authentication.name} + '/blogs/edit'"
                       class="btn btn-outline-success my-2 my-sm-0">写博客</a>
                </div>
                <form action="/logout" th:action="@{/logout}" method="post">
                    <input class="btn btn-outline-success my-2 my-sm-0" type="submit" value="退出">
                </form>
            </div>


            <div sec:authorize="isAnonymous()">
                <a href="/login" class="btn btn-outline-success my-2 my-sm-0" type="submit">登录</a>
                <a href="/register" class="btn btn-outline-success my-2 my-sm-0" type="submit">注册</a>
            </div>

        </div>

    </div>
</nav>
</body>
</html>